<script type="text/javascript">
function  deleteZimmer(id , name){
	if (confirm("<?PHP LangText('DeleteMas'); ?>")) {//if yes
	   window.location = document.URL+'&BuchungID='+id;
	}
}
</script>
<?php
$UserID = $_SESSION["CMS_User"]["ID"];
if(!empty($_GET['BuchungID'])){
	$sql="select * From buchung WHERE ID={$_GET['BuchungID']}";
	$_rd=mysql_query($sql,$_db_link);
	$str="";
	if($_rd){
		$daten = mysql_fetch_array($_rd,MYSQL_ASSOC);
		if($daten['TouristID']){
			$sql = 'DELETE  FROM tourist WHERE ID='.$daten['TouristID'];
			mysql_query($sql, $_db_link);
		}
	}	
	$sql = 'DELETE  FROM buchung WHERE ID='.$_GET['BuchungID'];
	mysql_query($sql, $_db_link);
}
if($UserID){
	$sql="select * From buchungview WHERE UserID=$UserID";
	$_rd=mysql_query($sql,$_db_link);
	$str="";
	if($_rd){
		$sw="row1";
		$str="<div class='FirmaView'><table class='FirmaList'>
		<tr class='$sw'>
		<td><b>".LangTextOut("ID")."</b></td>
		<td><b>".LangTextOut("firmaname")."</b></td>
		<td><b>".LangTextOut("PreisErwachsene")."</b></td>" .
		"<td><b>".LangTextOut("KinderPreis")."</b></td>" .
		"<td><b>".LangTextOut("Erwachsene")."</b></td>" .
		"<td><b>".LangTextOut("Kinder")."</b></td>" .
		"<td><b>".LangTextOut("Preis")."</b></td>" .
		"<td><b>".LangTextOut("Ubernacht")."</b></td>" .
		"<td><b>".LangTextOut("datum")."</b></td>" .
		"</tr>";
		while($daten=mysql_fetch_array($_rd,MYSQL_ASSOC)){
			if($sw=="row1"){
				$sw="row2";
				}else{
				$sw="row1";
			}
			$str=$str."<tr class='$sw'>
			<td>".$daten["BuchungID"]."</td>
			<td>".$daten["Name"]."</td>
			<td>".$daten["PreisErwachsene"]."</td>" .
			"<td>".$daten["KinderPreis"]."</td>" .
			"<td>".$daten["Erwachsene"]."</td>" .
			"<td>".$daten["Kinder"]."</td>" .
			"<td>".$daten["Preis"]."</td>" .
			"<td>".$daten["Ubernacht"]."</td>" .
			"<td>".$daten["datum"]."</td>" .
			"<td><a href='index.php?tag=$tagID&page=BuchungView&MoudeTagID=$MoudeTagID&BuchungID=".$daten["BuchungID"]."'>"
			.LangTextOut("Detail")."</a></td>" .
			"<td><a  href=\"javascript:deleteZimmer('".$daten["BuchungID"]."','');\"  >".LangTextOut("Delete")."</a>" .
					"</td>".
			"</tr>";
			}	
		$str=$str."</table></div>";
	}
	echo $str;
}
?>

